package com.wkhyapp.lm.base;

import android.app.AlertDialog;
import android.content.ClipboardManager;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.google.gson.Gson;
import com.wkhyapp.lm.app.WkhyApp;


public abstract class SuperFragment<P extends BasePresenter> extends BaseFragment {
    protected P mPresenter;
    public Gson gson = new Gson();
    public ClipboardManager myClipboard;
    public WkhyApp mApplication;
    public AlertDialog.Builder builder;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        mPresenter = createPresenter();
        mApplication = (WkhyApp)getActivity().getApplication();
        return super.onCreateView(inflater, container, savedInstanceState);

    }


    protected abstract P createPresenter();

    public void TToast(String msg){
        Toast.makeText(getActivity(),msg, Toast.LENGTH_SHORT).show();
    }
    @Override
    public void onDestroyView() {
        super.onDestroyView();
        if (mPresenter != null) {
            mPresenter.detachView();
        }
    }


}
